// DlgPropertyInfo.cpp : implementation file
//

#include "stdafx.h"
#include "GameNetManager.h"
#include "DlgPropertyInfo.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDlgPropertyInfo dialog


CDlgPropertyInfo::CDlgPropertyInfo(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgPropertyInfo::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgPropertyInfo)
	m_strLoginName = _T("");
	m_strLoginPwd = _T("");
	m_strRoleName = _T("");
	m_strScriptName = _T("");
	m_strStateText = _T("");
	m_lpCurShowingAcc=NULL;
	//}}AFX_DATA_INIT
}


void CDlgPropertyInfo::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgPropertyInfo)
	DDX_Control(pDX, IDC_EDIT_ROLE_INFO, m_editRoleInfo);
	DDX_Control(pDX, IDC_STATIC_BASE_INFO, m_staticBaseInfo);
	DDX_Control(pDX, IDC_STATIC_ROLE_INFO, m_static_RoleInfo);
	DDX_Text(pDX, IDC_EDIT_LOGINNAME, m_strLoginName);
	DDX_Text(pDX, IDC_EDIT_LOGINPWD, m_strLoginPwd);
	DDX_Text(pDX, IDC_EDIT_ROLENAME, m_strRoleName);
	DDX_Text(pDX, IDC_EDIT_SCRIPT, m_strScriptName);
	DDX_Text(pDX, IDC_EDIT_STATE, m_strStateText);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgPropertyInfo, CDialog)
	//{{AFX_MSG_MAP(CDlgPropertyInfo)
	ON_WM_SIZE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgPropertyInfo message handlers 

void CDlgPropertyInfo::SetPropertyInfo(lpAccount pAcc)
{
	if(pAcc==NULL) return;
	m_strLoginName.Format(_T("%s"),pAcc->m_tcLoginName);
	m_strLoginPwd.Format(_T("%s"),pAcc->m_tcLoginPwd);
	m_strRoleName.Format(_T("%s"),pAcc->m_tcRoleName);
	m_strScriptName.Format(_T("%s"),pAcc->m_tcScriptName);
	m_strStateText=GetSateText((em_ServerState)pAcc->m_iState);
	CString m_strRoleInfo=_T("");
	m_strRoleInfo.Format(_T("%s"),pAcc->m_tcRoleInfo);
	m_editRoleInfo.SetWindowText(m_strRoleInfo);
	m_lpCurShowingAcc=pAcc;
	UpdateData(FALSE);
}

void CDlgPropertyInfo::InintSize()
{
	CRect clientRect,RoleInfoRect; 
	GetClientRect(&clientRect);
	m_staticBaseInfo.GetClientRect(&RoleInfoRect);
	m_staticBaseInfo.MoveWindow(clientRect.left+4,RoleInfoRect.top+5,clientRect.right-8,RoleInfoRect.bottom);
	m_static_RoleInfo.MoveWindow(clientRect.left+4,clientRect.top+122,clientRect.right-8,clientRect.bottom-125);
	
	//m_editRoleInfo.GetClientRect(&RoleInfoRect);
	//m_editRoleInfo.MoveWindow(clientRect.left+4,RoleInfoRect.top+5,clientRect.right-8,RoleInfoRect.bottom);
}

BOOL CDlgPropertyInfo::OnInitDialog() 
{
	CDialog::OnInitDialog();
	InintSize();
	return TRUE; 
}

void CDlgPropertyInfo::OnSize(UINT nType, int cx, int cy) 
{
	CDialog::OnSize(nType, cx, cy);
	InintSize();
}
